﻿CREATE PROCEDURE [ServiceEngine].[DeQueueRepositoryChange]
	
AS
BEGIN 

	SET NOCOUNT ON
	
	DELETE A 
	OUTPUT DELETED.ChangeID, DELETED.Message, DELETED.CreateDate
	FROM ServiceEngine.RepositoryChanges A
	WHERE NOT EXISTS (SELECT 1 FROM [ServiceEngine].RepositoryChanges B WHERE B.CreateDate < A.CreateDate)

END